<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .screen{
      width: 200px;
      height: 100px;
      margin: 0 auto;
      background-color: grey;
      color: white;
      font-size: 30px;
      line-height: 100px;
      text-align: center;
      border-radius: 10px;
    }
    .add-btn{
      margin: 10px auto;
      width: 100px;
      height: 50px;
      font-size: 30px;
      line-height: 50px;
      display: block;
    }
  </style>
</head>
<body>
<h1 id="abc">这是一个标题</h1>
<h1>这也是一个标题</h1>
<div>这是一个div</div>
<div class="screen">0</div>
<button class="add-btn">+</button>
<script>
  //可以使用querySelector选中上述h1元素对应的对象
  let elem = document.querySelector('div');
  elem.onclick = function(){
    console.log(elem.innerHTML);
    elem.innerHTML+='这是追加的内容'
  }

  let addBtn = document.querySelector('.add-btn');
  let screen = document.querySelector('.screen');
  addBtn.onclick=function(){
    //1.拿到screen里面的数值
    let number = screen.innerHTML;
    //2.针对number+1
    //由于innerHTML 拿到的结果是string,要想进行算术运算，需要把string=>number
    number = parseInt(number);
    number+=1;
    //3.写回到元素中
    screen.innerHTML=number;
  }
</script>
</body>
</html>